Der's blag

Der's blag

Pulseaudio 5.1 and 7.1 surround sound simulation with stereo hardware

Tinkering

That is a very quick post I am only writing because there’s just not enough information about this topic.

While tinkering with Cyberpunk 77 under wine/proton I have discovered the game only outputs sound in 7.1 format, even if stereo headphones are connected.

Sound is always output in 7.1 format even when headphones or 2.1 speakers are connected. You can check it here: Control Panel - Sound - Speakers (select from the list) - Properties - Levels - Play Control (Balance) - and you will see a list of all channels.

Since for Windows user emulating 7.1 sound via some third-party software helped, I decided to try to reproduce the same thing under Linux.

Doing so with pulseaudio was a challenge, but unfortunately did not help at all. Maybe it will be useful for something else.

You will need:

  • Some files which describe simulation model.
    • For 5.1:
    • For 7.1:
      • Follow this guide. While files which are generated are produced from HeSuVi, which it’s source is public, license is nowhere to be specified. So distributing these files is questionable.
      • Additionally for 7.1 pulseaudio-git is required. These changes are not currently (December 2020) released, or something else was wrong with my non-git setup.
  • the config file ~/.config/pulse/default.pa:
#!/usr/bin/pulseaudio -nF

.include /etc/pulse/default.pa

# if you to try this, modify master= with your sink
# you can list all the sinks using `pacmd list-sinks`
# also fix the path for .wav files

# Uncomment for 5.1
#load-module module-virtual-surround-sink sink_name="Surround 5.1" hrir=/home/user/hrir/hrir_kemar/hrir-kemar.wav master=alsa_output.pci-0000_09_00.4.analog-stereo

# Uncomment for 7.1
# load-module module-virtual-surround-sink sink_name="Surround 7.1" sink_master="alsa_output.pci-0000_09_00.4.analog-stereo" hrir_left=/home/user/hrir/atmos_L.wav hrir_right=/home/user/hrir/atmos_R.wav

You need to restart pulseaudio after the config is changed.

winecfg recognizes this virtual sink only as a 5.1 device, so probably the issue is that some other internal components do not understand 8-channel sound.